home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / spacewar / bits.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-31  |  448 b   |  32 lines

  1. /*
  2.  * Spacewar - turn bits on, off, and return value
  3.  *
  4.  * Copyright 1985 obo Systems, Inc.
  5.  * Copyright 1985 Dan Rosenblatt
  6.  */
  7.  
  8. #include "spacewar.h"
  9.  
  10. #define BPB    8    /* bits per byte */
  11.  
  12. VOID biton(ary,bitno)
  13. char ary[];
  14. int bitno;
  15. {
  16.     ary[bitno/BPB] |= 1<<(bitno%BPB);
  17. }
  18.  
  19. VOID bitoff(ary,bitno)
  20. char ary[];
  21. int bitno;
  22. {
  23.     ary[bitno/BPB] &= ~(1<<(bitno%BPB));
  24. }
  25.  
  26. nabit(ary,bitno)
  27. char ary[];
  28. int bitno;
  29. {
  30.     return((ary[bitno/BPB]>>(bitno%BPB))&1);
  31. }
  32.